package com.chunxuan.langquan.dao.http;

import com.chunxuan.langquan.base.Config;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class APIRetrofit2 {
    private static ApiService2 SERVICE;

    public static ApiService2 getDefault() {
        if (SERVICE == null) {

            SERVICE = new Retrofit.Builder()
//                    .baseUrl(Constant.RETROFIT_URL)
                    .baseUrl(Config.URL)
                    .addConverterFactory(GsonConverterFactory.create())
                    .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                    .client(Config.getClient())
                    .build().create(ApiService2.class);
        }
        return SERVICE;
    }
}
